<template>
  <div>
    <Modal v-model="grayPop" width="40" class-name="vertical-center-modal" :closable="false" :mask-closable="false">
      <!-- 页头 -->
      <div slot="header" class="head-sty">
        <div class="title">
          <img src="@/assets/images/home/warning.png" class="wr-ic" alt="">
          {{ $t('goods.buy_before_know') }}
        </div>
        <div class="wr-tx">{{ $t('goods.know_content_text') }}</div>
      </div>
      <!-- 内容 -->
      <div class="content-wrap">
        <div class="key-word">
          <span class="tag">{{ $t('goods.key_text') }}</span>
          <span class="word">{{ keyWords }}</span>
        </div>
        <div class="text">{{ $t('goods.know_tip_content') }}</div>
      </div>
      <!-- 底部 -->
      <div slot="footer">
        <Checkbox v-model="checkBox" class="check-sty">{{ $t('goods.check_label_text') }}</Checkbox>
        <div class="footer-wrap">
          <div class="cancel-btn" @click="closeMet()">{{ $t('user.cancel') }}</div>
          <div :class="checkBox ? 'confirm-btn' : 'gray-btn'" @click="confirmMet()">{{ $t('personal.Search-confirm') }}
          </div>
        </div>
      </div>
    </Modal>
  </div>
</template>
<script>
import { debounce } from "@/common/common";
export default {
  data() {
    return {
      grayPop: false,
      checkBox: false,
      keyWords: ''
    }
  },
  methods: {
    open(val) {
      this.keyWords = val;
      this.grayPop = true;
    },
    closeMet() {
      this.grayPop = false;
      if (window.history.length > 1) {
        try {
          this.$router.go(-1);
        } catch (error) {
          window.history.back();
        }
      } else {
        this.$router.push('/');
      }
    },
    confirmMet() {
      if (!this.checkBox) {
        this.$Message.warning(this.$t('submitParcel.checkRiskAlert'));
        return;
      }
      this.grayPop = false;
    }
  }
}
</script>

<style lang="less" scoped>
:deep(.ivu-modal-content) {
  border-radius: 12px;

  .ivu-modal-header {
    height: 204px;
    background: #FF7C18;
    border-radius: 12px 12px 0 0;
    border: none;
    padding: 32px 24px 26px 32px;
  }

  .ivu-modal-body {
    padding: 0 32px;
  }

  .ivu-modal-footer {
    border: none;
    padding: 32px;
  }
}

.vertical-center-modal {
  display: flex;
  align-items: center;
  justify-content: center;

  .head-sty {

    .title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      font-size: 24px;
      color: #FFFFFF;
      line-height: 28px;

      .wr-ic {
        width: 24px;
        height: 24px;
      }
    }

    .wr-tx {
      font-weight: 500;
      font-size: 20px;
      color: #FFFFFF;
      line-height: 24px;
      text-align: justify;
      margin-top: 42px;
    }
  }

  .content-wrap {
    padding-top: 20px;
    padding-bottom: 32px;

    .key-word {
      margin-bottom: 26px;

      .tag {
        min-width: 88px;
        height: 38px;
        background: #FFF7EA;
        border-radius: 4px 4px 4px 4px;
        border: 1px solid #FE9400;
        padding: 6px 12px;
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 18px;
        color: #FE9400;
        line-height: 38px;
      }

      .word {
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 20px;
        color: #1E1714;
        line-height: 38px;
        margin-left: 20px;
      }
    }

    .text {
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 20px;
      color: #767B93;
      line-height: 26px;
      text-align: justify;
    }
  }

  .check-sty {
    font-weight: 400;
    font-size: 16px;
    color: #AEB0B9;
    line-height: 19px;
    margin-right: 0;

    :deep(.ivu-checkbox) {
      margin-right: 8px;
    }

    :deep(.ivu-checkbox-checked .ivu-checkbox-inner) {
      border-color: #1E1714;
      background-color: #1E1714;
      box-shadow: none;
    }
  }

  .footer-wrap {
    display: flex;
    justify-content: end;
    gap: 20px;
    margin-top: 12px;

    .cancel-btn {
      min-width: 112px;
      height: 46px;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid #DCDFE6;
      font-family: Open Sans, Open Sans;
      font-weight: 600;
      font-size: 16px;
      color: #1E1714;
      line-height: 19px;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .confirm-btn {
      min-width: 141px;
      height: 46px;
      border-radius: 8px 8px 8px 8px;
      background: #1E1714;
      font-family: Open Sans, Open Sans;
      font-weight: 600;
      font-size: 16px;
      color: #FFFFFF;
      line-height: 19px;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .gray-btn {
      min-width: 141px;
      height: 46px;
      border-radius: 8px 8px 8px 8px;
      background: #A9A9A9;
      font-family: Open Sans, Open Sans;
      font-weight: 600;
      font-size: 16px;
      color: #FFFFFF;
      line-height: 19px;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
</style>
